package ui.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import common.common.Common;

public class LoginServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	// protected static final Logger log = Common.getLogger();
	// protected boolean isPost = false;

	@Override
	public final void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException, ServletException {
		this.doPost(req, resp);
	}

	@Override
	public final void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws IOException, ServletException {

		// log.setLevel(Level.ALL);
		// isPost = req.getMethod().equals("POST");
		// if (isPost) {
		// log.info("POST");
		// } else {
		// log.info("GET");
		// log.info(req.getPathInfo());
		// log.info(req.getPathTranslated());
		// log.info(req.getQueryString());
		// log.info(req.getRequestURL().toString());
		// log.info(req.getLocalAddr());
		// }

		if (req.getParameter("") != null) {
			resp.sendRedirect(Common.PAGE_HOME);
		} else {
			resp.sendRedirect("userHome");
		}
	}
}
